<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>主页 | 短信平台</title>
<jsp:include page="/WEB-INF/jsp/common/commonlist.jsp"></jsp:include>
<script type="text/javascript">
function bodyLoad(){
	activeMenuItem("messageManageItem","templateCatItem");
}

//确定下拉框 
function loadSelect(){
	var templateCat = document.getElementById('dropdown');
    for(var i=0;i<templateCat.options.length;i++){
        if(templateCat.options[i].value== '<c:out value="${template.templateId}"/>'){
        	templateCat.options[i].selected="true";
        }

    }
}

$(document).ready(function() {
	$("#templateForm").validate({
		rules :{ 
			tag:{
	        	required : true,
	        	maxlength : 20
	        },
	        template:{
	        	required : true,
	        	maxlength : 80
	        }
		},
		 messages : {
			 name :{
			    	required : "姓名不能为空"
			    }
		    }
		});
	});
</script>
</head>
<body onload="bodyLoad();loadSelect();">
<div id="body-wrapper">
  <!-- Wrapper for the radial gradient background -->
  <div id="sidebar">
    <div id="sidebar-wrapper">
      <!-- Sidebar with logo and menu -->
      <h1 id="sidebar-title"><a href="#">短信平台</a></h1> 
      <!-- Logo (221px wide) -->

      <!-- Sidebar Profile links -->
	
		 <!--  页面左上角的部分 -->
     <%@include file="/WEB-INF/jsp/common/leftTop.jsp" %>
     <!-- 页面左侧菜单部分 -->
     <%@include file="/WEB-INF/jsp/common/menu.jsp" %>
      
      <!-- End #messages -->
    </div>
  </div>
  <!-- End #sidebar -->
  <div id="main-content">
    <!-- Main Content Section with everything -->
   
   <%@ include file="/WEB-INF/jsp/common/top.jsp" %>
    <!-- End .shortcut-buttons-set -->
    <div class="clear"></div>
    <!-- End .clear -->
    <div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>新建短信模板</h3>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
        <div class="tab-content default-tab" id="tab2">
          <form action="addTemplateCat.do" method="post" id="templateForm">
          <input type="hidden" name="tempId" value="<c:out value="${tempId}"/>"/>
            <fieldset>
            <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
            <p>
              <label>选择类别：</label>
              <select name="dropdown" class="group" id="dropdown">
              <c:forEach var="result" items="${resultList}"> 
              <option value="<c:out value="${result.tempId}"/>" id=""><c:out value="${result.tempTitle}"></c:out></option>
              </c:forEach>
              </select>
            </p>
               <p>
              <label style="display: inline; width: 90px;">标签：</label>
              <input class="text-input small-input" type="text" id="small-input" name="tag" value="<c:out value="${template.tag}"/>"/>
              <!-- Classes for input-notification: success, error, information, attention -->
              <br /></p>
            <p>
              <label>信息内容：</label>
              <textarea class="text-input textarea wysiwyg" id="textarea" name="template" cols="79" rows="15"><c:out value="${template.content}"></c:out></textarea>
            </p>
            <p>
              <input class="button" type="submit" value="提  交" />
             
            </p>
            </fieldset>
            <div class="clear"></div>
            <!-- End .clear -->
          </form>
        </div>
        <!-- End #tab2 -->
      </div>
      <!-- End .content-box-content -->
    </div>
    <!-- End .content-box -->
    <div class="clear"></div>
    <%@ include file="/WEB-INF/jsp/common/copyright.jsp" %>
  </div>
  <!-- End #main-content -->
</div>
<script>
<c:if test="${!(message eq '') && message != null}">
 alert('${message}');
</c:if>
<c:if test="${!(error eq '') && error != null}">
alert('${error}');
</c:if>
</script>

</body>
</html>